package com.PVZ.model.plant;

import com.PVZ.model.Anime;
import com.PVZ.model.emuns.AnimeType;
import com.PVZ.model.emuns.MoveType;
import com.PVZ.model.emuns.PlantType;
import com.PVZ.utils.Util;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author ISY
 * @create 2021-06-01 16:20
 */
@Getter
@Setter
public class Tallnut extends Plant{
    public Tallnut(int row,int col,MoveType moveType) {
        super(PlantType.Tallnut,row,col,moveType);
        this.setReviseY(-30);
        this.setBoxPadding(-20, -30, 90, 80);

        setAnime();
    }

    public Tallnut(int row,int col) {
        super(PlantType.Tallnut,row,col,MoveType.Stop);
        this.setReviseY(-30);
        this.setBoxPadding(-20, -30, 90, 80);

        setAnime();
    }

    public Tallnut() {
        super(PlantType.Caltrop, MoveType.Stop);
        this.setReviseY(-30);
        this.setHealth(300);
        // this.setBoxPadding(-20, -30, 90, 80);
        this.setImgSrc("res/img/plantPng/Tallnut/Tallnut-5.png");
        setAnime();
    }


    @Override
    public void setAnime() {
        Map<AnimeType, Anime> animeMap = new HashMap<>();

        Anime anime = new Anime();
        //图片文件夹地址
        String src = "res/img/plantPng/Tallnut";
        anime.setAnimeSrc(src);
        anime.setAnimeIndex(0);
        anime.setAnimePlayMode(-1);

        int startIndex = 15;
        int endIndex = 37;
        // anime.setStartIndex(startIndex);
        // anime.setEndIndex(endIndex);

        List<String> animeList = Util.addImageToList(startIndex, endIndex, src,"Tallnut");
        anime.setAnimeList(animeList);

        //设置当前显示动画的地址
        anime.setCurPic(animeList.get(0));

        animeMap.put(AnimeType.MOVE, anime);

        setAnimeMap(animeMap);
    }

}
